#include <stdio.h>

void main()
{
	int a = 0, b = 0, c = 0, d = 0;
	scanf("%1d%1d%1d%1d", &a, &b, &c, &d);
	//printf("%1d%1d%1d%1d", a, b, c, d);
	a = (a + 5) % 10;
	b = (b + 5) % 10;
	c = (c + 5) % 10;
	d = (d + 5) % 10;

	printf("%d%d%d%d", d, c, b, a);

}
